from db_config import db_init as db
#数据模型类

#用户模型
class User(db.Model):
    #数据库 数据表的名字
    __tablename__ = 'user_main'
    # 多个字段
    userID = db.Column(db.Integer, primary_key=True, autoincrement=True)
    userName = db.Column(db.String(20), nullable=False)
    userPWD = db.Column(db.String(20), nullable=False)
    userInfo = db.Column(db.String(512), nullable=True)
    userEditTime = db.Column(db.Date, nullable=False)
    
    def __repr__(self):
        # 打印对象：名字
        return '<User %s>' % self.username

# 股票收藏模型

class StockCollect(db.Model):
    __tablename__ = 'stock_collect'
    collectID = db.Column(db.Integer,nullable=False,primary_key=True)
    userID = db.Column(db.Integer, nullable=False)
    stockName = db.Column(db.String(10),nullable = False)

#策略模型
class Strategy(db.Model):
    __tablename__ = 'strategy'
    straid = db.Column(db.Integer,nullable=False,primary_key=True)
    userID = db.Column(db.Integer, nullable=False)
    straName = db.Column(db.String(50),nullable=False)
    runTime = db.Column(db.Integer,nullable=False)
    rollbackTime = db.Column(db.Integer,nullable=False)
    code = db.Column(db.Text,nullable=True)








